.class public Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;
.super Ljava/lang/Object;
.source "SegmentIntersector.java"


# instance fields
.field private bdyNodes:[Ljava/util/Collection;

.field private hasIntersection:Z

.field private hasProper:Z

.field private hasProperInterior:Z

.field private includeProper:Z

.field private li:Lcom/vividsolutions/jts/algorithm/LineIntersector;

.field private numIntersections:I

.field public numTests:I

.field private properIntersectionPoint:Lcom/vividsolutions/jts/geom/Coordinate;

.field private recordIsolated:Z


# direct methods
.method public constructor <init>(Lcom/vividsolutions/jts/algorithm/LineIntersector;ZZ)V
    .locals 2

    .line 82
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/4 v0, 0x0

    .line 59
    iput-boolean v0, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->hasIntersection:Z

    .line 60
    iput-boolean v0, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->hasProper:Z

    .line 61
    iput-boolean v0, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->hasProperInterior:Z

    const/4 v1, 0x0

    .line 63
    iput-object v1, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->properIntersectionPoint:Lcom/vividsolutions/jts/geom/Coordinate;

    .line 70
    iput v0, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->numIntersections:I

    .line 73
    iput v0, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->numTests:I

    .line 83
    iput-object p1, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->li:Lcom/vividsolutions/jts/algorithm/LineIntersector;

    .line 84
    iput-boolean p2, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->includeProper:Z

    .line 85
    iput-boolean p3, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->recordIsolated:Z

    return-void
.end method

.method public static isAdjacentSegments(II)Z
    .locals 0

    sub-int/2addr p0, p1

    .line 52
    invoke-static {p0}, Ljava/lang/Math;->abs(I)I

    move-result p0

    const/4 p1, 0x1

    if-ne p0, p1, :cond_0

    goto :goto_0

    :cond_0
    const/4 p1, 0x0

    :goto_0
    return p1
.end method

.method private isBoundaryPoint(Lcom/vividsolutions/jts/algorithm/LineIntersector;Ljava/util/Collection;)Z
    .locals 1

    .line 204
    invoke-interface {p2}, Ljava/util/Collection;->iterator()Ljava/util/Iterator;

    move-result-object p2

    :cond_0
    invoke-interface {p2}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_1

    .line 205
    invoke-interface {p2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/vividsolutions/jts/geomgraph/Node;

    .line 206
    invoke-virtual {v0}, Lcom/vividsolutions/jts/geomgraph/Node;->getCoordinate()Lcom/vividsolutions/jts/geom/Coordinate;

    move-result-object v0

    .line 207
    invoke-virtual {p1, v0}, Lcom/vividsolutions/jts/algorithm/LineIntersector;->isIntersection(Lcom/vividsolutions/jts/geom/Coordinate;)Z

    move-result v0

    if-eqz v0, :cond_0

    const/4 p1, 0x1

    return p1

    :cond_1
    const/4 p1, 0x0

    return p1
.end method

.method private isBoundaryPoint(Lcom/vividsolutions/jts/algorithm/LineIntersector;[Ljava/util/Collection;)Z
    .locals 3

    const/4 v0, 0x0

    if-nez p2, :cond_0

    return v0

    .line 197
    :cond_0
    aget-object v1, p2, v0

    invoke-direct {p0, p1, v1}, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->isBoundaryPoint(Lcom/vividsolutions/jts/algorithm/LineIntersector;Ljava/util/Collection;)Z

    move-result v1

    const/4 v2, 0x1

    if-eqz v1, :cond_1

    return v2

    .line 198
    :cond_1
    aget-object p2, p2, v2

    invoke-direct {p0, p1, p2}, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->isBoundaryPoint(Lcom/vividsolutions/jts/algorithm/LineIntersector;Ljava/util/Collection;)Z

    move-result p1

    if-eqz p1, :cond_2

    return v2

    :cond_2
    return v0
.end method

.method private isTrivialIntersection(Lcom/vividsolutions/jts/geomgraph/Edge;ILcom/vividsolutions/jts/geomgraph/Edge;I)Z
    .locals 1

    if-ne p1, p3, :cond_3

    .line 126
    iget-object p3, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->li:Lcom/vividsolutions/jts/algorithm/LineIntersector;

    invoke-virtual {p3}, Lcom/vividsolutions/jts/algorithm/LineIntersector;->getIntersectionNum()I

    move-result p3

    const/4 v0, 0x1

    if-ne p3, v0, :cond_3

    .line 127
    invoke-static {p2, p4}, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->isAdjacentSegments(II)Z

    move-result p3

    if-eqz p3, :cond_0

    return v0

    .line 129
    :cond_0
    invoke-virtual {p1}, Lcom/vividsolutions/jts/geomgraph/Edge;->isClosed()Z

    move-result p3

    if-eqz p3, :cond_3

    .line 130
    invoke-virtual {p1}, Lcom/vividsolutions/jts/geomgraph/Edge;->getNumPoints()I

    move-result p1

    sub-int/2addr p1, v0

    if-nez p2, :cond_1

    if-eq p4, p1, :cond_2

    :cond_1
    if-nez p4, :cond_3

    if-ne p2, p1, :cond_3

    :cond_2
    return v0

    :cond_3
    const/4 p1, 0x0

    return p1
.end method


# virtual methods
.method public addIntersections(Lcom/vividsolutions/jts/geomgraph/Edge;ILcom/vividsolutions/jts/geomgraph/Edge;I)V
    .locals 6

    if-ne p1, p3, :cond_0

    if-ne p2, p4, :cond_0

    return-void

    .line 153
    :cond_0
    iget v0, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->numTests:I

    const/4 v1, 0x1

    add-int/2addr v0, v1

    iput v0, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->numTests:I

    .line 154
    invoke-virtual {p1}, Lcom/vividsolutions/jts/geomgraph/Edge;->getCoordinates()[Lcom/vividsolutions/jts/geom/Coordinate;

    move-result-object v0

    aget-object v0, v0, p2

    .line 155
    invoke-virtual {p1}, Lcom/vividsolutions/jts/geomgraph/Edge;->getCoordinates()[Lcom/vividsolutions/jts/geom/Coordinate;

    move-result-object v2

    add-int/lit8 v3, p2, 0x1

    aget-object v2, v2, v3

    .line 156
    invoke-virtual {p3}, Lcom/vividsolutions/jts/geomgraph/Edge;->getCoordinates()[Lcom/vividsolutions/jts/geom/Coordinate;

    move-result-object v3

    aget-object v3, v3, p4

    .line 157
    invoke-virtual {p3}, Lcom/vividsolutions/jts/geomgraph/Edge;->getCoordinates()[Lcom/vividsolutions/jts/geom/Coordinate;

    move-result-object v4

    add-int/lit8 v5, p4, 0x1

    aget-object v4, v4, v5

    .line 159
    iget-object v5, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->li:Lcom/vividsolutions/jts/algorithm/LineIntersector;

    invoke-virtual {v5, v0, v2, v3, v4}, Lcom/vividsolutions/jts/algorithm/LineIntersector;->computeIntersection(Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;Lcom/vividsolutions/jts/geom/Coordinate;)V

    .line 165
    iget-object v0, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->li:Lcom/vividsolutions/jts/algorithm/LineIntersector;

    invoke-virtual {v0}, Lcom/vividsolutions/jts/algorithm/LineIntersector;->hasIntersection()Z

    move-result v0

    if-eqz v0, :cond_4

    .line 166
    iget-boolean v0, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->recordIsolated:Z

    const/4 v2, 0x0

    if-eqz v0, :cond_1

    .line 167
    invoke-virtual {p1, v2}, Lcom/vividsolutions/jts/geomgraph/Edge;->setIsolated(Z)V

    .line 168
    invoke-virtual {p3, v2}, Lcom/vividsolutions/jts/geomgraph/Edge;->setIsolated(Z)V

    .line 171
    :cond_1
    iget v0, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->numIntersections:I

    add-int/2addr v0, v1

    iput v0, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->numIntersections:I

    .line 175
    invoke-direct {p0, p1, p2, p3, p4}, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->isTrivialIntersection(Lcom/vividsolutions/jts/geomgraph/Edge;ILcom/vividsolutions/jts/geomgraph/Edge;I)Z

    move-result v0

    if-nez v0, :cond_4

    .line 176
    iput-boolean v1, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->hasIntersection:Z

    .line 177
    iget-boolean v0, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->includeProper:Z

    if-nez v0, :cond_2

    iget-object v0, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->li:Lcom/vividsolutions/jts/algorithm/LineIntersector;

    invoke-virtual {v0}, Lcom/vividsolutions/jts/algorithm/LineIntersector;->isProper()Z

    move-result v0

    if-nez v0, :cond_3

    .line 179
    :cond_2
    iget-object v0, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->li:Lcom/vividsolutions/jts/algorithm/LineIntersector;

    invoke-virtual {p1, v0, p2, v2}, Lcom/vividsolutions/jts/geomgraph/Edge;->addIntersections(Lcom/vividsolutions/jts/algorithm/LineIntersector;II)V

    .line 180
    iget-object p1, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->li:Lcom/vividsolutions/jts/algorithm/LineIntersector;

    invoke-virtual {p3, p1, p4, v1}, Lcom/vividsolutions/jts/geomgraph/Edge;->addIntersections(Lcom/vividsolutions/jts/algorithm/LineIntersector;II)V

    .line 182
    :cond_3
    iget-object p1, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->li:Lcom/vividsolutions/jts/algorithm/LineIntersector;

    invoke-virtual {p1}, Lcom/vividsolutions/jts/algorithm/LineIntersector;->isProper()Z

    move-result p1

    if-eqz p1, :cond_4

    .line 183
    iget-object p1, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->li:Lcom/vividsolutions/jts/algorithm/LineIntersector;

    invoke-virtual {p1, v2}, Lcom/vividsolutions/jts/algorithm/LineIntersector;->getIntersection(I)Lcom/vividsolutions/jts/geom/Coordinate;

    move-result-object p1

    invoke-virtual {p1}, Lcom/vividsolutions/jts/geom/Coordinate;->clone()Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Lcom/vividsolutions/jts/geom/Coordinate;

    iput-object p1, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->properIntersectionPoint:Lcom/vividsolutions/jts/geom/Coordinate;

    .line 184
    iput-boolean v1, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->hasProper:Z

    .line 185
    iget-object p1, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->li:Lcom/vividsolutions/jts/algorithm/LineIntersector;

    iget-object p2, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->bdyNodes:[Ljava/util/Collection;

    invoke-direct {p0, p1, p2}, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->isBoundaryPoint(Lcom/vividsolutions/jts/algorithm/LineIntersector;[Ljava/util/Collection;)Z

    move-result p1

    if-nez p1, :cond_4

    .line 186
    iput-boolean v1, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->hasProperInterior:Z

    :cond_4
    return-void
.end method

.method public hasProperInteriorIntersection()Z
    .locals 1

    .line 114
    iget-boolean v0, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->hasProperInterior:Z

    return v0
.end method

.method public hasProperIntersection()Z
    .locals 1

    .line 109
    iget-boolean v0, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->hasProper:Z

    return v0
.end method

.method public setBoundaryNodes(Ljava/util/Collection;Ljava/util/Collection;)V
    .locals 2

    const/4 v0, 0x2

    .line 91
    new-array v0, v0, [Ljava/util/Collection;

    iput-object v0, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->bdyNodes:[Ljava/util/Collection;

    .line 92
    iget-object v0, p0, Lcom/vividsolutions/jts/geomgraph/index/SegmentIntersector;->bdyNodes:[Ljava/util/Collection;

    const/4 v1, 0x0

    aput-object p1, v0, v1

    const/4 p1, 0x1

    .line 93
    aput-object p2, v0, p1

    return-void
.end method
